const express = require('express');
const router = express.Router();
const { protect } = require('../middleware/auth');
const usersController = require('../controllers/usersController');

// @route   GET /api/users/list
// @desc    获取用户列表
// @access  Private
router.post('/list', protect, usersController.getUsers);

// @route   POST /api/users/add
// @desc    新增用户
// @access  Private
router.post('/add', protect, usersController.createUser);

// @route   PUT /api/users/edit
// @desc    编辑用户
// @access  Private
router.post('/edit', protect, usersController.updateUser);

// @route   POST /api/users/restPwd
// @desc    重置密码
// @access  Private
router.post('/restPwd', protect, usersController.restPwd);

// @route   DELETE /api/users/del
// @desc    删除用户
// @access  Private
router.post('/del', protect, usersController.deleteUser);

module.exports = router;